package com.LeetCode.Math;

import org.junit.Test;

import java.util.List;

/**
 * LeetCode  FizzBuzz
 */
public class FizzBuzz {

    public List<String> fissBuzz(int n){
        return (List<String>) new java.util.AbstractList<String>() {
            int i = 0;

            @Override
            public int size() {
                return n;
            }

            @Override
            public String get(int i) {
                ++i;
                switch ((i%3 == 0 ? 1 : 0) + (i % 5 == 0 ? 2 : 0)){
                    case 0 : return String.valueOf(i);
                    case 1 : return "Fizz";
                    case 2 : return "Buzz";
                    case 3 : return "FizzBuzz";
                }
                return "";
            }
        };
    }

    @Test
    public void test(){
        fissBuzz(15).forEach(System.out::println);
    }
}
